package com.shinechain.controller;


import com.shinechain.service.user.impl.ProxyImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;


@RequestMapping(value = "/api" )
public class TelegramUserConrtoller {

    @Autowired
  //  TelegramUserMapper telegramUserMapper;


    @ResponseBody
    @RequestMapping(value = "isChannel")
    public String isChannel(HttpServletRequest request){
        boolean flag = false;
        String userId = request.getParameter("userId");
        System.out.println(userId);

        //https://api.telegram.org/bot634777415:AAFmTHfxYspSOudhzhsqmfajH37VoUla-IU/getChatMember?chat_id=@leekChannel&user_id=433888893
       return ProxyImpl.getShineChainChatBot().checkChannel("@leekChannel",Integer.parseInt(userId));

    }

    @ResponseBody
    @RequestMapping(value = "sendKeyBoard")
    public String sendKeyBoard(HttpServletRequest request){
        String chatId = request.getParameter("chatId");

        //ChatId 前面要加上-100才行
        return ProxyImpl.getShineChainChatBot().sendKeyBoard("-100"+chatId);

    }



}
